﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;

namespace QuanLySuKien.model
{
    public class KhuVuc
    {

        string connectionString = "Data Source=ATU-PC\\SQLEXPRESS;Initial Catalog=DemoDNN;User ID=sa;Password=tieutuht";
        SqlConnection con = null;
        public KhuVuc()
        {
            con = new SqlConnection(connectionString);
        }

        public int InsertUpdate(string sql)
        {
            try
            {
                con.Open();
                using (con)
                {
                    SqlCommand cmd = new SqlCommand(sql, con);
                    cmd.CommandText = sql;
                    return cmd.ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error:" + ex);
                return 0;
            }
        }

    }
}